package technion.gc.api.interfaces;


/** Traversal Strategy Interface. Implement to use as your
 *  traversal strategy for Graph Crawler.
 *
 */
public interface ITraversalStrategy {
	/** Sets Graph to be used by the Traversal Strategy.
	*	
	* @param graph	The Graph
	*/
	public void setGraph(IGraph graph);
	
	/** Returns the next node to act upon.
	*   This is the heart of the traversal strategy.
	*	
	* @return	Next node found by the strategy
	*/
	public AbstractGraphNode getNextGraphNode();
	
	/** Check if there is more nodes to be traversed
	*   in the graph by the strategy.
	*	
	* @return	True if there are more nodes (or node) to traverse.
	*/
	public boolean hasNextGraphNode();
	
	/** Inform the strategy that a node has been encountered.
	*   Used by the Graph Crawler.
	*	
	* @param graphNode	 
	*/
	public void encountered(AbstractGraphNode graphNode);
	
	/** Inform the strategy that a node has been encountered again.
	*   Used by the Graph Crawler.
	*	
	* @param graphNode	 
	*/
	public void encounteredAgain(AbstractGraphNode graphNode);
	
	/** Perform a clean up for the strategy if state is present.
	*   Make sure that after calling this method the instance is 
	*   reusable (clean it's state).
	*   Used by the Graph Crawler and allows subsequent calls on
	*   different graphs.
	*/
	public void cleanup();
}
